/*
 * Copyright 2009-2015 by WWW.KNET.CN  All rights reserved.
 */

package cn.knet.sp.ncrm.modules.call.config.entity;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * 更新类型
 *
 * @author zhangbin
 * @version 2015 /07/08 11:25:41
 */
public enum CallConfigType {
	WORKSHIFT("WORKSHIFT", "班次"),
	CALLING("CALLING", "通话"),
	//RATE("RATE", "频率"),
	EXECUTE("EXECUTE", "手动执行"),
	OUTGROUP("OUTGROUP","呼出分组"),
	INGROUP("INGROUP","呼入分组");

	private static final Map<String, String> MAPPING = new LinkedHashMap<String, String>();
	private static final Map<String, String> INVERSE_MAPPING = new LinkedHashMap<String, String>();

	private String value;
	private String text;

	static {
		for (CallConfigType em : CallConfigType.values()) {
			MAPPING.put(em.getText(), em.getValue());
			INVERSE_MAPPING.put(em.getValue(), em.getText());
		}
	}

	/**
	 *
	 * @param value
	 * @param text
	 */
	CallConfigType(final String value, final String text) {
		this.value = value;
		this.text = text;
	}

	public String getValue() {
		return value;
	}

	public String getText() {
		return text;
	}

	/**
	 *
	 * @param enumValue
	 * @return
	 */
	public static CallConfigType get(String enumValue) {
		for (CallConfigType em : CallConfigType.values()) {
			if (em.getValue().equals(enumValue)) {
				return em;
			}
		}
		throw new IllegalArgumentException("Can't get enum with this enumValue.");
	}

	/**
	 *
	 * @return
	 */
	public static Map<String, String> mapping() {
		return MAPPING;
	}

	/**
	 *
	 * @return
	 */
	public static Map<String, String> inverseMapping() {
		return INVERSE_MAPPING;
	}
}
